$(function(){	
	$('#search_transfer').live('click', function() {
		adminTransfer.searchTransfer('page');
	});	
	$('#export_transfer').live('click', function() {
		adminTransfer.searchTransfer('csv');
	});	
});


var adminTransfer = (function(){
	
	var searchTransfer = function(type) {
		var s_username = $('#s_username').val();
		var s_status = $('#s_status').val();
		var s_o_d = $('#s_o_d').val();
		var s_n_d = $('#s_n_d').val();
		var s_t_start = $('#s_t_start').val();
		var s_t_end = $('#s_t_end').val();
		var url = _siteUrl+'transfer/index?search[s_username]='+encodeURI(s_username)+'&search[s_status]='+s_status+'&search[s_o_d]='+s_o_d+'&search[s_n_d]='+s_n_d+'&search[s_t_start]='+s_t_start+'&search[s_t_end]='+s_t_end+'&search[type]='+type;
	
		//if(searchtype=='csv') {
		//	
		//} else {
			//document.location.href = url;
		//}
		if(type=='csv') {
			window.open(url); 	
		} else if(type=='page'){
			document.location.href = url;
		}
	}
	 
	return {
		searchTransfer : searchTransfer
	};
 
})();